import type { R, TableDataInfo } from '@/api/model/resultModel';
import type { XhljParticipantsForm, XhljParticipantsQuery, XhljParticipantsVo } from '@/api/xhlj/model/participantsModel';
import { request } from '@/utils/request';

// 查询参会人员列表
export function listParticipants(query?: XhljParticipantsQuery) {
  return request.get<TableDataInfo<XhljParticipantsVo>>({
    url: '/xhlj/participants/list',
    params: query,
  });
}

// 查询参会人员详细
export function getParticipants(participantsId: number) {
  return request.get<R<XhljParticipantsVo>>({
    url: `/xhlj/participants/${participantsId}`,
  });
}

// 新增参会人员
export function addParticipants(data: XhljParticipantsForm) {
  return request.post<R<void>>({
    url: '/xhlj/participants',
    data,
  });
}

// 修改参会人员
export function updateParticipants(data: XhljParticipantsForm) {
  return request.put<R<void>>({
    url: '/xhlj/participants',
    data,
  });
}

// 删除参会人员
export function delParticipants(participantsIds: number | Array<number>) {
  return request.delete<R<void>>({
    url: `/xhlj/participants/${participantsIds}`,
  });
}
